.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]));
- assert_that(p.cargo_process("build"), execs());
+ assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
assert_that(process(&p.bin("foo")),
- execs().with_stdout("i am foo\n"));
+ execs().with_status(0).with_stdout("i am foo\n"));
}
#[test]
.file("src/foo.rs", "fn main() {} fn dead() {}");
assert_that(p.cargo_process("build"),
- execs().with_stderr_contains("\
+ execs().with_status(0).with_stderr_contains("\
[..]function is never used: `dead`[..]
"));
}
"#);
assert_that(p.cargo_process("build"),
- execs().with_stderr_contains("\
+ execs().with_status(0).with_stderr_contains("\
[..]function is never used: `dead`[..]
"));
assert_that(
process(&p.bin("foo")),
- execs().with_stdout("test passed\n"));
+ execs().with_status(0).with_stdout("test passed\n"));
}
#[test]
assert_that(
process(&p.bin("foo")),
- execs().with_stdout("test passed\n"));
+ execs().with_status(0).with_stdout("test passed\n"));
}
#[test]
assert_that(
process(&p.bin("foo")),
- execs().with_stdout("test passed\n"));
+ execs().with_status(0).with_stdout("test passed\n"));
}
#[test]
assert_that(
process(&p.bin("foo")),
- execs().with_stdout("test passed\n"));
+ execs().with_status(0).with_stdout("test passed\n"));
}
#[test]
assert_that(&p.bin("libbaz.rlib"), is_not(existing_file()));
assert_that(process(&p.bin("foo")),
- execs().with_stdout("test passed\n"));
+ execs().with_status(0).with_stdout("test passed\n"));
}
// Check that Cargo gives a sensible error if a dependency can't be found
assert_eq!("foo", PKG_NAME);
assert_eq!("http://example.com", HOMEPAGE);
assert_eq!("This is foo", DESCRIPTION);
+ let s = format!("{}.{}.{}-{}", VERSION_MAJOR,
+ VERSION_MINOR, VERSION_PATCH, VERSION_PRE);
assert_eq!(s, VERSION);
}
"#)
println!("bin");
assert_that(process(&p.bin("foo")),
- execs().with_stdout(&format!("0-5-1 @ alpha.1 in {}\n",
- p.root().display())));
+ execs().with_status(0).with_stdout(&format!("0-5-1 @ alpha.1 in {}\n",
+ p.root().display())));
println!("test");
assert_that(p.cargo("test").arg("-v"),
println!("bin");
assert_that(process(&p.bin("foo")),
- execs().with_stdout("wycats@example.com:neikos@example.com"));
+ execs().with_status(0).with_stdout("wycats@example.com:neikos@example.com"));
println!("test");
assert_that(p.cargo("test").arg("-v"),
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
.symlink("Notafile", "bar");
- assert_that(p.cargo_process("build"), execs());
+ assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
assert_that(process(&p.bin("foo")),
- execs().with_stdout("i am foo\n"));
+ execs().with_status(0).with_stdout("i am foo\n"));
}
#[test]
assert_that(p.cargo_process("test").arg("-v"), execs().with_status(0));
assert_that(process(&p.bin("examples/hello")),
- execs().with_stdout("Hello, World!\n"));
+ execs().with_status(0).with_stdout("Hello, World!\n"));
assert_that(process(&p.bin("examples/goodbye")),
- execs().with_stdout("Goodbye, World!\n"));
+ execs().with_status(0).with_stdout("Goodbye, World!\n"));
}
#[test]
assert_that(p.cargo_process("test"), execs().with_status(0));
assert_that(process(&p.bin("examples/hello")),
- execs().with_stdout("Hello, World!\n"));
+ execs().with_status(0).with_stdout("Hello, World!\n"));
assert_that(process(&p.bin("examples/goodbye")),
- execs().with_stdout("Goodbye, World!\n"));
+ execs().with_status(0).with_stdout("Goodbye, World!\n"));
}
#[test]
assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(process(&p.bin("foo")),
- execs().with_stdout("slow\n"));
+ execs().with_status(0).with_stdout("slow\n"));
}
#[test]
assert_that(p.cargo_process("build").arg("--release"),
execs().with_status(0));
assert_that(process(&p.release_bin("foo")),
- execs().with_stdout("fast\n"));
+ execs().with_status(0).with_stdout("fast\n"));
}
#[test]
assert_that(&p.bin("foo"), existing_file());
assert_that(process(&p.bin("foo")),
- execs());
+ execs().with_status(0));
let loc = p.root().join("Cargo.lock");
let mut lockfile = String::new();
assert_that(p.cargo_process("build").arg("-p").arg("d1").arg("-p").arg("d2")
.arg("-p").arg("foo"),
- execs());
+ execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
assert_that(process(&p.bin("foo")),
- execs().with_stdout("i am foo\n"));
+ execs().with_status(0).with_stdout("i am foo\n"));
let d1_path = &p.build_dir().join("debug")
.join(format!("d1{}", env::consts::EXE_SUFFIX));
.join(format!("d2{}", env::consts::EXE_SUFFIX));
assert_that(d1_path, existing_file());
- assert_that(process(d1_path), execs().with_stdout("d1"));
+ assert_that(process(d1_path), execs().with_status(0).with_stdout("d1"));
assert_that(d2_path, existing_file());
assert_that(process(d2_path),
- execs().with_stdout("d2"));
+ execs().with_status(0).with_stdout("d2"));
}
#[test]
assert_that(p.cargo_process("build").arg("-v")
.arg("--message-format").arg("json"),
- execs().with_json(r#"
+ execs().with_status(0).with_json(r#"
{
"reason":"compiler-message",
"package_id":"bar 0.5.0 ([..])",
assert_that(p.cargo_process("rustc").arg("--bin").arg("foo")
.arg("--message-format").arg("JSON").arg("--").arg("-Zno-trans"),
- execs()
+ execs().with_status(0)
.with_stderr_contains("[WARNING] the option `Z` is unstable [..]")
.with_json(r#"
{
assert_that(p.cargo_process("build")
.arg("--all"),
- execs().with_stderr("[..] Compiling bar v0.1.0 ([..])\n\
+ execs().with_status(0)
+ .with_stderr("[..] Compiling bar v0.1.0 ([..])\n\
[..] Compiling foo v0.1.0 ([..])\n\
[..] Finished debug [unoptimized + debuginfo] target(s) in [..]\n"));
}
// The order in which foo and bar are built is not guaranteed
assert_that(p.cargo_process("build")
.arg("--all"),
- execs().with_stderr_contains("[..] Compiling bar v0.1.0 ([..])")
+ execs().with_status(0)
+ .with_stderr_contains("[..] Compiling bar v0.1.0 ([..])")
.with_stderr_contains("[..] Compiling foo v0.1.0 ([..])")
.with_stderr("[..] Compiling [..] v0.1.0 ([..])\n\
[..] Compiling [..] v0.1.0 ([..])\n\
assert_that(p.cargo_process("build")
.arg("--all"),
- execs().with_stderr("[..] Updating registry `[..]`\n\
+ execs().with_status(0)
+ .with_stderr("[..] Updating registry `[..]`\n\
[..] Downloading a v0.1.0 ([..])\n\
[..] Compiling a v0.1.0\n\
[..] Compiling a v0.1.0 ([..])\n\
assert_eq!(hello(), "hello")
}"#);
- assert_that(p.cargo_process("build"), execs());
+ assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
assert_that(process(&p.bin("foo")),
- execs().with_stdout("hello\n"));
+ execs().with_status(0).with_stdout("hello\n"));
assert_that(p.cargo("test"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.5.0 ({})
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]", p.url()))
.file("bar/src/lib.rs", "pub fn bar() {}");
assert_that(p.cargo_process("test").arg("-v").arg("--release"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] bar v0.0.1 ({dir}/bar)
[RUNNING] [..] -C opt-level=3 [..]
[COMPILING] foo v0.1.0 ({dir})
"#);
assert_that(p.cargo_process("test").arg("-v").arg("hello"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.5.0 ({url})
[RUNNING] `rustc [..] src[/]foo.rs [..]`
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
assert_eq!(hello(), "nope")
}"#);
- assert_that(p.cargo_process("build"), execs());
+ assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
assert_that(process(&p.bin("foo")),
- execs().with_stdout("hello\n"));
+ execs().with_status(0).with_stdout("hello\n"));
assert_that(p.cargo("test"),
execs().with_stderr(format!("\
");
assert_that(p.cargo_process("test"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]baz-[..][EXE]
"#);
assert_that(p.cargo_process("test"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
"#);
assert_that(p.cargo_process("test"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]external-[..][EXE]
");
assert_that(p.cargo_process("test"),
- execs().with_stderr(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
.file("tests/foo.rs", "");
assert_that(p.cargo_process("test").arg("--test=foo"),
- execs().with_stderr("\
+ execs().with_status(0).with_stderr("\
[COMPILING] foo v0.0.1 ([..])
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]foo[..][EXE]")
"#);
assert_that(p.cargo_process("test"),
- execs().with_stderr("\
+ execs().with_status(0).with_stderr("\
[COMPILING] foo v0.0.1 ([..])
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
[DOCTEST] foo")
"#);
assert_that(p.cargo_process("test"),
- execs().with_stdout(""));
+ execs().with_status(0).with_stdout(""));
}
#[test]
extern crate foo;
"#);
assert_that(p.cargo_process("test"),
- execs().with_stderr("\
+ execs().with_status(0).with_stderr("\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] bar v0.0.1 ([..])
[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
assert_that(p.cargo_process("test")
.arg("--all"),
- execs().with_stdout_contains("\
+ execs().with_status(0).with_stdout_contains("\
running 1 test
test foo_test ... ok
assert_that(p.cargo_process("test")
.arg("--all"),
- execs().with_stdout_contains("\
+ execs().with_status(0).with_stdout_contains("\
running 1 test
test b ... ok
assert_that(p.cargo_process("test")
.arg("--all"),
- execs().with_stdout_contains("\
+ execs().with_status(0).with_stdout_contains("\
running 1 test
test a ... ok